<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

use AppVue\Http\Models\ResponseResult;
use Illuminate\Http\Request;

Auth::routes();
Route::get('/error/401', function () {
    return view('error.401');
});

Route::get('/home', 'HomeController@home')->middleware('auth');

Route::get('/', 'HomeController@index');
Route::get('/index', 'HomeController@index');

Route::get('/admin', function () {
    return view('home');
})->middleware(['auth', 'admin']);

Route::group(['prefix' => 'record', 'middleware' => ['auth', 'admin']], function () {
    Route::get('/append', 'RecordController@append');
    Route::get('/view', 'RecordController@view');
    Route::post('/set', 'RecordController@set');
    Route::post('/delete', 'RecordController@delete');
    Route::post('/child/add', 'RecordController@addChild');
    Route::post('/child/delete', 'RecordController@delChild');
    Route::get('/child/edit', 'RecordController@editChild');
    Route::post('/child/edit', 'RecordController@editChildP');
});

Route::get('/record/{id}', 'RecordController@recordView');
Route::get('/record/child/{id}', 'RecordController@recordChildView');

Route::post('/upload/image', 'UploadFileController@uplaodImage');

Route::get('/change/password', 'UserController@changePassword')->middleware('auth');
Route::post('/change/password', 'UserController@changePassword')->middleware('auth');
Route::post('/upload/img', 'UploadFileController@uploadImg');